<?xml version="1.0" encoding="utf-8"?>
<!-- DWXMLSource="cotizacion.xml" -->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc='http://wlm.com.mx/SAI/doc'>
  <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
  <xsl:decimal-format name="dollar"
decimal-separator="." grouping-separator=","/>
  <xsl:template match="//doc:Documento">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Documento Cotizacion</title>
    </head>
    <link href="http://localhost:50860/XMLCss/xslTrans.css" rel="stylesheet" type="text/css" />
    <body>
    <div id="ContenedorPrincipal">
      <div id="header">pedido</div>
      <div style="margin-top:5px;"> <img src="http://localhost:50860/XMLCss/logomph.png" align="left" style="margin-right:15px; width:300px"/>AVENIDA BENITO JUAREZ SUR 78

<br/>
        CENTRO<br/>
        TIZAYUCA  HIDALGO, 43800<br/>
        779-796-4527<br />
        ventas@mphardware.com
        </div>
      <div style="display:block; width:800px;">
        <div id="NombreCliente"> Cliente No. <xsl:value-of select="@NoCliente"/>  - <xsl:value-of select="@NombreComercial"/> - <xsl:value-of select="@NombreCliente"/></div>
        <div>
        <div style="float:left;width:266px;">
          <table id="meta">
            <tbody>
              <tr>
                <td class="meta-head">Documento #</td>
                <td><xsl:value-of select="@NoPedido"/></td>
              </tr>
              <tr>
                <td class="meta-head">F. Solicitud</td>
                <td><xsl:call-template name="FormatDate">
                    <xsl:with-param name="DateTime" select="@FechaCreacion"/>
                    
                  </xsl:call-template></td>
              </tr>
              <tr>
                <td class="meta-head">F. Autorizacion</td>
                <td><xsl:call-template name="FormatDate">
                    <xsl:with-param name="DateTime" select="@FechaPedido"/>
                    
                  </xsl:call-template></td>
              </tr>
              <tr>
                <td class="meta-head">Condiciones</td>
                <td><div class="due"><xsl:value-of select="@CondicionesPago"/></div></td>
              </tr>
            </tbody>
          </table>
        </div>
        <div style="float:left; width:266px;">
          <table id="meta">
            <tbody>
              <tr>
                <td class="meta-head">Telefono</td>
                <td><div><xsl:value-of select="@telefono"/></div></td>
              </tr>
              <tr>
                <td class="meta-head">FAX</td>
                <td><div><xsl:value-of select="@fax"/></div></td>
              </tr>
              <tr>
                <td class="meta-head">Email</td>
                <td><div><xsl:value-of select="@email"/></div></td>
              </tr>
              <tr>
                <td class="meta-head">RFC</td>
                <td><div class="due"><xsl:value-of select="@RFC"/></div></td>
              </tr>
            </tbody>
          </table>
        </div>
        <div style="float:left; width:266px;">
          <table id="meta">
            <tbody>
              <tr>
                <td class="meta-head">Contacto</td>
                <td><div><xsl:value-of select="@nombreContacto"/></div></td>
              </tr>
              <tr>
                <td class="meta-head">Telefono</td>
                <td><div><xsl:value-of select="@telefonoContacto"/></div></td>
              </tr>
              <tr>
                <td class="meta-head">Celular</td>
                <td><div><xsl:value-of select="@celularContacto"/></div></td>
              </tr>
              <tr>
                <td class="meta-head">Email</td>
                <td><div><xsl:value-of select="@emailContacto"/></div></td>
              </tr>
            </tbody>
          </table>
        </div>
        </div>
        <div>
        <xsl:apply-templates select="//doc:DireccionFacturacion"/>
        
        <xsl:apply-templates select="//doc:DireccionEnvio"/>
        </div>
      </div>
      <div>
      <div id="NombreCliente"> CONCEPTOS</div>
        <table id="items">
          <tbody>
            <tr>
              <th>Clave</th>
              <th>Categoria</th>
              <th>Linea</th>
              <th>Marca</th>
              <th>Descripcion</th>
              <th>Cantidad</th>
              <th>Precio</th>
              <th>Importe</th>
            </tr>
            <xsl:apply-templates select="//doc:Concepto"/>
            
            <xsl:for-each select="Concepto">
            </xsl:for-each>
           <tr>
              <td colspan="5" rowspan="4" class="blank" valign="top" style="padding:20px;"><b>Observaciones</b><br /><xsl:value-of select="//doc:Observaciones"/></td>
              <td colspan="2" class="total-line">Subtotal</td>
              <td class="total-value moneda"><div id="subtotal">$<xsl:value-of select="format-number(@SubTotal, '#,##0.00','dollar')"/></div></td>
            </tr>
            <tr>
              <td colspan="2" class="total-line">Descuento</td>
              <td class="total-value moneda"><div id="total"><xsl:value-of select="format-number(@Descuento, '#,##0.00','dollar')"/> %</div></td>
            </tr>
            <tr>
              <td colspan="2" class="total-line">I.V.A.</td>
              <td class="total-value moneda">$<xsl:value-of select="format-number(@IVA, '#,##0.00','dollar')"/></td>
            </tr>
            <tr>
              <td colspan="2" class="total-line balance">TOTAL</td>
              <td class="total-value balance moneda"><div class="due">$<xsl:value-of select="format-number(@Total, '#,##0.00','dollar')"/></div></td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    </body>
    </html>
  </xsl:template>
  <xsl:template match="//doc:Concepto">
    <tr class="item-row">
      <td ><xsl:value-of select="@noIdentificacion"/></td>
      <td ><xsl:value-of select="@categoria"/></td>
      <td ><xsl:value-of select="@linea"/></td>
      <td ><xsl:value-of select="@marca"/></td>
      <td class="description"><xsl:value-of select="@modelo"/>-<xsl:value-of select="@descripcion"/></td>
      <td class="moneda"><xsl:value-of select="@cantidad"/></td>
      <td class="moneda">$<xsl:value-of select="format-number(@valorUnitario, '#,##0.00','dollar')"/></td>
      <td class="moneda"><span class="price">$<xsl:value-of select="format-number(@importe, '#,##0.00','dollar')"/></span></td>
    </tr>
  </xsl:template>
  <xsl:template match="//doc:DireccionFacturacion">
    <div id="address">
    <div id="addressheader">Direccion de Facturacion:</div>
    <table id="meta-1">
            <tbody>
              <tr>
                <td class="meta-head">Calle</td>
                <td><xsl:value-of select="@Calle"/><xsl:value-of select="@NumeroExterior"/>-<xsl:value-of select="@NumeroInterior"/></td>
              </tr>
              <tr>
                <td class="meta-head">Colonia</td>
                <td><xsl:value-of select="@Colonia"/></td>
              </tr>
              <tr>
                <td class="meta-head">Ciudad</td>
                <td><xsl:value-of select="@Ciudad"/></td>
              </tr>
              <tr>
                <td class="meta-head">Municipio</td>
                <td><xsl:value-of select="@Municipio"/></td>
              </tr>
              <tr>
                <td class="meta-head">Estado</td>
                <td><xsl:value-of select="@Estado"/></td>
              </tr>
              <tr>
                <td class="meta-head">C.P.</td>
                <td><xsl:value-of select="@CodigoPostal"/></td>
              </tr>
              </tbody>
              </table>
              </div>
  </xsl:template>
  <xsl:template match="//doc:DireccionEnvio">
    <div id="address"><div id="addressheader">Direccion de Envio:</div>
    <table id="meta-1">
            <tbody>
              <tr>
                <td class="meta-head">Calle</td>
                <td><xsl:value-of select="@Calle"/><xsl:value-of select="@NumeroExterior"/>-<xsl:value-of select="@NumeroInterior"/></td>
              </tr>
              <tr>
                <td class="meta-head">Colonia</td>
                <td><xsl:value-of select="@Colonia"/></td>
              </tr>
              <tr>
                <td class="meta-head">Ciudad</td>
                <td><xsl:value-of select="@Ciudad"/></td>
              </tr>
              <tr>
                <td class="meta-head">Municipio</td>
                <td><xsl:value-of select="@Municipio"/></td>
              </tr>
              <tr>
                <td class="meta-head">Estado</td>
                <td><xsl:value-of select="@Estado"/></td>
              </tr>
              <tr>
                <td class="meta-head">C.P.</td>
                <td><xsl:value-of select="@CodigoPostal"/></td>
              </tr>
              </tbody>
              </table>
              </div>
  </xsl:template>
  <xsl:template name="FormatDate">
    <xsl:param name="DateTime" />
    <xsl:variable name="year" select="substring($DateTime,1,4)" />
    <xsl:variable name="month-temp" select="substring-after($DateTime,'-')" />
    <xsl:variable name="month" select="substring-before($month-temp,'-')" />
    <xsl:variable name="day-temp" select="substring-after($month-temp,'-')" />
    <xsl:variable name="day" select="substring($day-temp,1,2)" />
    <xsl:variable name="time" select="substring-after($DateTime,'T')" />
    <xsl:variable name="hh" select="substring($time,1,2)" />
    <xsl:variable name="mm" select="substring($time,4,2)" />
    <xsl:variable name="ss" select="substring($time,7,2)" />
    
    <!-- Long DATE FORMAT -->
    
    <xsl:value-of select="$day"/><xsl:value-of select="' de '"/><!--January -->
    <!--January 12 -->
    <xsl:choose>
      <xsl:when test="$month = '1' or $month= '01'">
        Enero
      </xsl:when>
      <xsl:when test="$month = '2' or $month= '02'">
        Febrero
      </xsl:when>
      <xsl:when test="$month= '3' or $month= '03'">
        Marzo
      </xsl:when>
      <xsl:when test="$month= '4' or $month= '04'">
        Abril
      </xsl:when>
      <xsl:when test="$month= '5' or $month= '05'">
        Mayo
      </xsl:when>
      <xsl:when test="$month= '6' or $month= '06'">
        Junio
      </xsl:when>
      <xsl:when test="$month= '7' or $month= '07'">
        Julio
      </xsl:when>
      <xsl:when test="$month= '8' or $month= '08'">
        Augosto
      </xsl:when>
      <xsl:when test="$month= '9' or $month= '09'">
        Septiembre
      </xsl:when>
      <xsl:when test="$month= '10'">
        Octubre
      </xsl:when>
      <xsl:when test="$month= '11'">
        Noviembre
      </xsl:when>
      <xsl:when test="$month= '12'">
        Diciembre
      </xsl:when>
    </xsl:choose>
    <xsl:value-of select="' de'"/><!--January 12,-->
    <xsl:value-of select="' '"/><!--January 12, -->
    <xsl:value-of select="$year"/><!--January 12, 2001-->
    <!--
    <xsl:value-of select="' a las '"/><xsl:value-of select="$hh"/><xsl:value-of select="':'"/><xsl:value-of select="$mm"/><xsl:value-of select="':'"/><xsl:value-of select="$ss"/><xsl:value-of select="' (GMT) '"/>-->
    <!-- END: Long DATE FORMAT -->
    
  </xsl:template>
</xsl:stylesheet>